-
Notifications
You must be signed in to change notification settings - Fork 16.6k
fix(dataset-editor): include calculated columns in currency code dropdown #37621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(dataset-editor): include calculated columns in currency code dropdown #37621
Conversation
…down The currency code column dropdown in the Dataset Editor only showed physical columns with type_generic === String, which excluded calculated columns because the backend does not resolve type metadata for them. Loosen the filter to also include columns with a truthy expression, so calculated columns (e.g. CASE statements mapping countries to currency codes) appear in the dropdown.
Code Review Agent Run #1c4f0fActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Sequence DiagramShows the fix where the Dataset Editor includes calculated columns (identified by a truthy expression) when building the currency code dropdown, despite those columns lacking backend-resolved type metadata. sequenceDiagram
participant DatasetEditor
participant Backend
participant Dropdown
participant User
DatasetEditor->>Backend: fetch_metadata()
Backend-->>DatasetEditor: columns (physical cols have type_generic; calculated cols lack type_generic but include expression)
DatasetEditor->>Dropdown: Build options filtered by (type_generic == String OR expression)
Dropdown-->>User: Render currency code list (includes calculated columns)
Generated by CodeAnt AI |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
… currency dropdown Narrow the filter to only include untyped calculated columns (type_generic is null) rather than all calculated columns. Calculated columns that the user explicitly typed as NUMERIC/BOOLEAN/DATETIME are now correctly excluded.
...rc/components/Datasource/components/DatasourceEditor/tests/DatasourceEditorCurrency.test.tsx
Outdated
Show resolved
Hide resolved
The ColumnObject type requires `type` to be a string, not null.
Avoid includes('amount') matching 'total_amount' by using exact text
comparison for numeric column assertions.
Code Review Agent Run #06560aActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
The Currency code column dropdown in the Dataset Editor excludes calculated columns that don't have a data type set, even though they are valid choices for currency code mapping (e.g. a
CASEstatement that maps country values to ISO currency codes likeUSD,EUR).Root cause: The dropdown filters on
type_generic === GenericDataType.String, but the backend only resolvestype_genericfor physical columns. Calculated columns without an explicitly set data type havetype_genericasnull, so they fail the check.Fix: Include calculated columns whose
type_genericisnull(untyped), while still excluding calculated columns the user explicitly typed as NUMERIC, BOOLEAN, or DATETIME via the Data Type dropdown:Fixes #37620
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before — calculated column

num_californiais missing from the dropdown:After — calculated column

num_californianow appears in the dropdown:TESTING INSTRUCTIONS
birth_names)CASE WHEN state = 'CA' THEN 'USD' ELSE 'EUR' END)num,num_boys) do not appearUnit tests:
ADDITIONAL INFORMATION